﻿/***********************************************************************************************************************************
 *    Name: Shrink_TLog.sql
 *  Author: Frank Figearo — http://www.sqlnerd.me/ — frank@sqlnerd.me
 * Summary: 
**/
DECLARE @db sysname; SET @db= DB_NAME();
CHECKPOINT;
EXECUTE master.DBAdmin.BackupTLOGs @db;
CHECKPOINT;
DBCC SHRINKFILE (2,0);
CHECKPOINT;
DBCC SHRINKFILE (2,0);
SELECT log_reuse_wait_desc FROM sys.databases WHERE name = DB_NAME()
GO